package com.kitten.dataAlign.constants;

/**
 * @author kitten
 */
public class RedisKeyConstants {
    /**
     * 布隆过滤器: 日增量变更数据, 用户笔记点赞/取消点赞
     */
    public static final String BLOOM_TODAY_NOTE_LIKE_LIST_KEY = "bloom:dataAlign:note:likes:noteIds:";

    public static String buildBloomUserNoteLikeListKey(String date) {
        return BLOOM_TODAY_NOTE_LIKE_LIST_KEY + date;
    }
    // 被点赞用户 日增量变更计数
    public static final String BLOOM_TODAY_USER_LIKE_LIST_KEY = "bloom:dataAlign:note:likes:userIds:";

    public static String buildBloomUserLikeListKey(String date) {
        return BLOOM_TODAY_USER_LIKE_LIST_KEY + date;
    }

    /**
     * 布隆过滤器: 日增量变更数据, 用户笔记收藏/取消收藏
     */
    public static final String BLOOM_TODAY_NOTE_COLLECT_LIST_KEY = "bloom:dataAlign:note:collects:noteIds:";

    public static String buildBloomUserNoteCollectListKey(String date) {
        return BLOOM_TODAY_NOTE_COLLECT_LIST_KEY + date;
    }
    // 被收藏用户 日增量变更计数
    public static final String BLOOM_TODAY_USER_COLLECT_LIST_KEY = "bloom:dataAlign:note:collects:userIds:";

    public static String buildBloomUserCollectListKey(String date) {
        return BLOOM_TODAY_USER_COLLECT_LIST_KEY + date;
    }

    /**
     * 布隆过滤器: 日增量变更数据, 用户笔记发布数目
     */
    public static final String BLOOM_TODAY_USER_NOTE_PUBLISH_COUNT = "bloom:dataAlign:user:note:publishCount:";

    public static String buildBloomUserNotePublishCountKey(String date) {
        return BLOOM_TODAY_USER_NOTE_PUBLISH_COUNT + date;
    }

    /**
     * 布隆过滤器: 日增量变更数据, 用户关注/粉丝列表
     */
    public static final String BLOOM_TODAY_USER_FOLLOW_LIST_KEY = "bloom:dataAlign:user:follows:";
    public static final String BLOOM_TODAY_USER_FANS_LIST_KEY = "bloom:dataAlign:user:fans:";

    public static String buildBloomUserFollowListKey(String date) {
        return BLOOM_TODAY_USER_FOLLOW_LIST_KEY + date;
    }
    public static String buildBloomUserFansListKey(String date) {
        return BLOOM_TODAY_USER_FANS_LIST_KEY + date;
    }

    /**
     * 用户维度计数 Key 前缀
     */
    private static final String COUNT_USER_KEY_PREFIX = "count:user:";
    // Hash FIELD
    public static final String FIELD_FOLLOWING_TOTAL = "followingTotal";

    public static final String FIELD_FANS_TOTAL = "fansTotal";

    public static final String FIELD_USER_LIKE_TOTAL = "likeTotal";

    public static final String FIELD_USER_COLLECT_TOTAL = "collectionTotal";

    public static final String FIELD_USER_NOTE_TOTAL = "noteTotal";

    public static String buildCountUserKey(Long userId) {
        return COUNT_USER_KEY_PREFIX + userId;
    }

    /**
     * 笔记维度计数 Key 前缀
     */
    private static final String COUNT_NOTE_KEY_PREFIX = "count:note:";
    // Hash FIELD
    public static final String FIELD_NOTE_LIKE_TOTAL = "likeTotal";

    public static final String FIELD_NOTE_COLLECT_TOTAL = "collectionTotal";

    public static String buildCountNoteKey(Long noteId) {
        return COUNT_NOTE_KEY_PREFIX + noteId;
    }

}
